<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="me.linczh.bank.bean.enums.Position" %>
<%@ page import="me.linczh.bank.bean.enums.Department" %>
<%@ page import="me.linczh.bank.bean.EmployeeBean" %>

<p>
	<%=request.getAttribute("contentpage") %>
</p>
<% if (request.getAttribute("employees") != null) {
			List<EmployeeBean> employees = (List<EmployeeBean>)request.getAttribute("employees");
			for (EmployeeBean e : employees) {
				if (e.getPosition() == Position.ADMIN) continue; %>
<p>
	[<%=e.getEmployee() %>]&nbsp;
	<%=e.getUsername() %>(<%=e.getPassword() %>):
	<%=e.getDepartment() %>&nbsp;
	<%=e.getPosition() %>
	<a class="btn btn-default btn-xs" href="employee.delete.action?employee=<%=e.getEmployee() %>">删除</a>
</p>
<%		}
	 } else { %>
<p>
<a class="btn btn-default" href="employee.query.action">Show All Employees</a>
</p>
<% } %>
<form action="employee.create.action" method="POST" role="form">
	<fieldset>
		<legend>新建雇员</legend>
		<div class="form-group">
	    <label for="username">雇员姓名</label>
	    <input type="text" class="form-control" id="username" name="username" placeholder="雇员姓名">
	  </div>
	  <div class="form-group">
	    <label for="department">部门</label>
	    <select class="form-control" id="department" name="department">
	    <% for (Department d : Department.values()) { %>
	    	<option value="<%=d.name() %>"><%=d.name() %></option>
	    <% } %>
	    </select>
	  </div>
	  <div class="form-group">
	    <label for="position">职位</label>
	    <select class="form-control" id="position" name="position">
	    <% for (Position p : Position.values()) { %>
	    	<option value="<%=p.name() %>"><%=p.name() %></option>
	    <% } %>
	    </select>
	  </div>
		<div class="form-group">
	    <label for="password">雇员密码</label>
	    <input type="password" class="form-control" id="password" name="password" placeholder="雇员密码">
	  </div>
	  <div class="form-group">
	    <label for="confirm">确认密码</label>
	    <input type="password" class="form-control" id="confirm" name="confirm" placeholder="确认密码">
	  </div>
	</fieldset>
	<button type="submit" class="btn btn-default">新建</button>
</form>